package com.qyhl.webtv.module_broke.scoop;

import com.qyhl.webtv.commonlib.entity.broke.ScoopTopicBean;
import com.qyhl.webtv.commonlib.entity.circle.ScoopListBean;

import java.util.List;

/**
 * Created by qyhl on 2017/12/10.
 */

public class ScoopHomePresenter implements ScoopHomeContract.ScoopHomePresenter {
    private ScoopHomeModel mModel;
    private ScoopHomeFragment mView;

    ScoopHomePresenter(ScoopHomeFragment mView) {
        this.mView = mView;
        this.mModel = new ScoopHomeModel(this);
    }

    @Override
    public void getTopic(boolean isFirst) {
        mModel.getTopic(isFirst);
    }

    @Override
    public void getDatas(String username, String topicId, String brokeId) {
        mModel.getDatas(username, topicId, brokeId);
    }

    @Override
    public void setTopic(List<ScoopTopicBean> beanList) {
        mView.setTopic(beanList);
    }

    @Override
    public void setError(int code, String msg) {
        switch (code) {
            case 0:
                mView.setNetError(msg);
                break;
            case 1:
                mView.showMessage(msg);
                break;
            case 2:
                mView.setEmpty(msg);
                break;
            case 3:
                mView.setEmpty(msg);
                break;
            case 4:
                mView.setError(msg);
                break;
            case 5:
                mView.showMessage(msg);
                break;
            default:
                break;
        }
    }

    @Override
    public void setDataError(int code, String msg) {
        switch (code) {
            case 0:
                mView.showDataMessage(msg);
                break;
            case 1:
                mView.showDataMessage(msg);
                break;
            case 2:
                mView.showLog(msg, true);
                break;
            case 3:
                mView.showLog(msg, false);
                break;
            case 4:
                mView.showDataMessage(msg);
                break;
            case 5:
                mView.showDataMessage(msg);
                break;
            default:
                break;
        }
    }

    @Override
    public void setDatas(List<ScoopListBean> beanList, boolean isMore) {
        mView.setDatas(beanList, isMore);
    }
}
